<template>
  <div class="pagination">
    <div style="margin-left:10px;">
      <el-button  v-if="exportShow" :type="type" size="mini" @click="handelExport">{{btnExport}}</el-button>
    </div>
    <el-pagination
      layout="total, sizes, prev, pager, next, jumper"
      :pagination="pagination"
      :page-size="pagination.pageSize"
      :current-page="pagination.currentPage"
      :total="pagination.total"
      :page-sizes="pagination.pageSizes"
      @current-change="handleCurrentChange"
      @size-change="handleSizeChange"
    />
  </div>
</template>

<script>
export default {
  props: {
    pagination: {
      type: Object,
      default: () => ({ pageSizes: [], pageSize: 10, currentPage: 1, total: 0 })
    },
    exportShow: {
      type:Boolean,
      required:false,
    },
    btnExport: {
      type: String,
      required: false
    },
    type: {
      type: String,
      required: false
    },
  },
  mounted(){
    this.pagination.currentPage = 1
    this.pagination.pageSize = 10
  },
  methods: {
    handleCurrentChange: function(val) {
      this.pagination.currentPage = val
      // this.$emit('refresh')
    },
    handleSizeChange: function(val) {
      this.pagination.pageSize = val
      // this.$emit('refresh')
    },
    handelExport() {
      this.$emit('handelExport')
    }
  }
}
</script>

<style>
.pagination {
  height: 45px;
  /* text-align: right; */
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding-top: 7px;
  padding-right: 20px;
}
</style>
